//
//  EFBChartTopView.m
//  Pods
//
//  Created by E.F.B on 15-5-27.
//
//

#import "EFBChartTopView.h"

@implementation EFBChartTopView
{
    UIImageView *imageView;
}

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor clearColor];
        imageView = [[UIImageView alloc] initWithFrame:frame];
        imageView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
        imageView.backgroundColor = [UIColor colorWithRed:48/255.0 green:62/255.0 blue:75/255.0 alpha:1.0f];
        [self addSubview:imageView];
        
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake((self.frame.size.width-246)/2,(self.frame.size.height-44)/2+8,246,44)];
        self.titleLabel.backgroundColor = [UIColor clearColor];
        self.titleLabel.textColor       = [UIColor whiteColor];
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
        self.titleLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth;
        self.titleLabel.font=[UIFont systemFontOfSize:24.0];
        self.titleLabel.numberOfLines = 2;
        self.titleLabel.adjustsFontSizeToFitWidth = YES;
        [self addSubview:self.titleLabel];
        self.autoresizingMask = UIViewAutoresizingFlexibleWidth;
        
    }
    return self;
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    
//    int frameWidth = self.frame.size.width;
//    if (frameWidth == 1024) {
//        imageView.image = [UIImage imageNamed:@"topbgView_landscape"];
//    }
//    else if(frameWidth == 768)
//    {
//        imageView.image = [UIImage imageNamed:@"topbgView"];
//    }
}


-(void)dealloc{
    [_titleLabel release];
    [imageView release];
    [super dealloc];
}

@end
